package thinkingJava.chapter19;
import static util.Print.*;

import java.util.EnumSet;
public class CarWash {
	public enum Cycle {
		UNDERBODY {
			public void action() {
				print("the under body");
			}
		},
		WHEELWASH {
			public void action() {
				print("washing the wheel");
			}
		},
		PREWASH {
			public void action() {
				print("loosening the dirt");
			}
		},
		BASIC {
			public void action() {
				print("The basic wash");
			}
		},
		HOTWAX {
			public void action() {
				print("using hot wax");
			}
		},
		RINSE {
			public void action() {
				print("the rinse");
			}
		},
		BLOWDRY {
			public void action() {
				print("washing the blowdry");
			}
		}
		;
		abstract void action();
	}
	EnumSet<Cycle> cycles = EnumSet.of(Cycle.BASIC, Cycle.RINSE);
	public void add(Cycle cycle) {
		cycles.add(cycle);
	}
	public void washCar() {
		for (Cycle c : cycles) {
			c.action();
		}
	}
	public String toString() {
		return cycles.toString();
	}
	public static void main(String[] args) {
		CarWash wash = new CarWash();
		print(wash);
		wash.washCar();
		wash.add(Cycle.BLOWDRY);
		wash.add(Cycle.BLOWDRY);
		wash.add(Cycle.HOTWAX);
		wash.add(Cycle.RINSE);
		print(wash);
		wash.washCar();
	}
}
